﻿// Inner Fire 游戏引擎库
// UI - 文本标签
//
// Copyright (c) 2025 by 尔西大帝. All rights reserved.
//
// 用于UI的组件-文本标签，显示一行文本
//
// Author: 尔西大帝
// Email: 2670613871@qq.com
// Created: 2025-01-07

#include "label.h"

namespace ifire::ui {

Label::Label(ikit::sstr name_id, const LabelInfo* info)
    : UIComponent(name_id), info_(info) {}

void Label::SetPosition(XMFLOAT2 position) { text_->SetPosition(position); }

size_t Label::Print(const char* format, ...) {
  va_list args;
  va_start(args, format);
  size_t result = text_->VPrint(format, args);
  va_end(args);
  return result;
}

size_t Label::VPrint(const char* format, va_list args) {
  return text_->VPrint(format, args);
}

void Label::SetText(const char* text, size_t len) { text_->SetText(text, len); }

void Label::SetVisible(bool state) {
  UIComponent::SetVisible(state);
  text_->SetVisible(state);
}
void Label::SetScale(XMFLOAT2 scale) {
  UIComponent::SetScale(scale);
  text_->SetScale(scale);
}
void Label::SetRefresh() { text_->SetRefresh(); }
} // namespace ifire::ui